package poj;

import java.util.Scanner;

public class POJ1002 {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int total = in.nextInt();
		//System.out.println(total);
		StringBuilder str = new StringBuilder("4873279ITS-EASY888-45673-10-10-10888-GLOPTUT-GLOP967-11-11310-GINOF101010888-1200-4-8-7-3-2-7-9-");
		/*while(in.hasNextLine()){
			//System.out.println(in.next());
			String temp = in.next();
			char[] ch = temp.toCharArray();
			if(ch[0] != '\r'||ch[0] != '\n'){
				str = str.append(temp);
				System.out.println("str:"+str);
			}else{
				break;
			}
		}*/
		/*for(int i = (int)'A'; i <= (int)'Z';i++)
		System.out.print((char)i +":"+ i + " ");*/
		str = new POJ1002().uppercaseToNum(str);
		System.out.println(str);
		str = new StringBuilder(str.toString().replaceAll("-", ""));
		StringBuilder[] strs = new StringBuilder[total];
		for(int i = 0; i < total; i++){
			strs[i] = new StringBuilder(str.subSequence(0, 7));
			str = new StringBuilder(str.subSequence(7, str.length()));
		}
		StringBuilder[] dublicate = new POJ1002().getDublicate(strs);
		for(StringBuilder sb : dublicate)
			System.out.println(sb);
		System.out.println("Over.");
		System.exit(1);
		
		/*StringBuilder string = new StringBuilder("javaworld");
		StringBuilder str1 = new StringBuilder(string.subSequence(0, 3));
		StringBuilder str2 = new StringBuilder(string.subSequence(3, string.length()));
		System.out.println("str1:"+str1.toString()+"  str2:"+str2);*/
		
		//System.out.println("java-ja-jj".replaceAll("-", ""));
		
	}
	
	public StringBuilder[] getDublicate(StringBuilder[] strs){
		StringBuilder[] temp = new StringBuilder[strs.length];
		int[] num = new int[strs.length];
		for(int i = 0; i < strs.length; i++){
			num[i] = 1;
		}
		for(int i = 0; i < strs.length; i++){
			for(int j = 0; j < strs.length; j++){
				if((strs[i].equals((strs)[j]))&&(i != j))
					num[i]++;	
			}
		}
		int counter = 0;
		for(int i = 0; i < strs.length; i++){
			if(num[i] > 1){
				temp[counter++] = strs[i].append(" " + i);
			}
		}

		//temp = temp.
		return temp;
	}
	
	public StringBuilder uppercaseToNum(StringBuilder str){
		for(int i = 0; i < str.length(); i++){
			if(str.charAt(i) >= (int)'A'&&str.charAt(i) <= (int)'C')
				str.replace(i, i, "i");
		}
		System.out.println("upper:"+str);
		for(int i = 0; i < str.length(); i++){
			if(str.charAt(i) >= (int)'D'&&str.charAt(i) <= (int)'F')
				str.replace(i, i, "i");
		}
		for(int i = 0; i < str.length(); i++){
			if(str.charAt(i) >= (int)'G'&&str.charAt(i) <= (int)'I')
				str.replace(i, i, "i");
		}
		for(int i = 0; i < str.length(); i++){
			if(str.charAt(i) >= (int)'J'&&str.charAt(i) <= (int)'L')
				str.replace(i, i, "i");
		}
		for(int i = 0; i < str.length(); i++){
			if(str.charAt(i) >= (int)'M'&&str.charAt(i) <= (int)'O')
				str.replace(i, i, "i");
		}
		for(int i = 0; i < str.length(); i++){
			if(str.charAt(i) == (int)'P'||str.charAt(i) == (int)'R'||str.charAt(i) == 'S')
				str.replace(i, i, "i");
		}
		for(int i = 0; i < str.length(); i++){
			if(str.charAt(i) >= (int)'T'&&str.charAt(i) <= (int)'V')
				str.replace(i, i, "i");
		}
		for(int i = 0; i < str.length(); i++){
			if(str.charAt(i) >= (int)'W'&&str.charAt(i) <= (int)'Y')
				str.replace(i, i, "i");
		}
		return str;
	}
	
	
}
